home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / AppleTalk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  47.3 KB  |  1,413 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        AppleTalk.h
  3.  
  4.      Contains:    AppleTalk Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __APPLETALK__
  18. #define __APPLETALK__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __OSUTILS__
  24. #include <OSUtils.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=mac68k
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49.  
  50. enum {
  51.                                                                 /* Driver unit numbers (ADSP is dynamic) */
  52.     mppUnitNum                    = 9,                            /* MPP unit number */
  53.     atpUnitNum                    = 10,                            /* ATP unit number */
  54.     xppUnitNum                    = 40                            /* XPP unit number */
  55. };
  56.  
  57.  
  58. enum {
  59.                                                                 /* Driver refNums (ADSP is dynamic) */
  60.     mppRefNum                    = -10,                            /* MPP reference number */
  61.     atpRefNum                    = -11,                            /* ATP reference number */
  62.     xppRefNum                    = -41                            /* XPP reference number */
  63. };
  64.  
  65.  
  66. enum {
  67.                                                                 /* .MPP csCodes */
  68.     lookupReply                    = 242,                            /* This command queued to ourself */
  69.     writeLAP                    = 243,                            /* Write out LAP packet */
  70.     detachPH                    = 244,                            /* Detach LAP protocol handler */
  71.     attachPH                    = 245,                            /* Attach LAP protocol handler */
  72.     writeDDP                    = 246,                            /* Write out DDP packet */
  73.     closeSkt                    = 247,                            /* Close DDP socket */
  74.     openSkt                        = 248,                            /* Open DDP socket */
  75.     loadNBP                        = 249,                            /* Load NBP command-executing code */
  76.     lastResident                = 249,                            /* Last resident command */
  77.     confirmName                    = 250,                            /* Confirm name */
  78.     lookupName                    = 251,                            /* Look up name on internet */
  79.     removeName                    = 252,                            /* Remove name from Names Table */
  80.     registerName                = 253,                            /* Register name in Names Table */
  81.     killNBP                        = 254,                            /* Kill outstanding NBP request */
  82.     unloadNBP                    = 255,                            /* Unload NBP command code */
  83.     setSelfSend                    = 256,                            /* MPP: Set to allow writes to self */
  84.     SetMyZone                    = 257,                            /* Set my zone name */
  85.     GetATalkInfo                = 258,                            /* get AppleTalk information */
  86.     ATalkClosePrep                = 259                            /* AppleTalk close query */
  87. };
  88.  
  89.  
  90. enum {
  91.                                                                 /* .ATP csCodes */
  92.     nSendRequest                = 248,                            /* NSendRequest code */
  93.     relRspCB                    = 249,                            /* Release RspCB */
  94.     closeATPSkt                    = 250,                            /* Close ATP socket */
  95.     addResponse                    = 251,                            /* Add response code | Require open skt */
  96.     sendResponse                = 252,                            /* Send response code */
  97.     getRequest                    = 253,                            /* Get request code */
  98.     openATPSkt                    = 254,                            /* Open ATP socket */
  99.     sendRequest                    = 255,                            /* Send request code */
  100.     relTCB                        = 256,                            /* Release TCB */
  101.     killGetReq                    = 257,                            /* Kill GetRequest */
  102.     killSendReq                    = 258,                            /* Kill SendRequest */
  103.     killAllGetReq                = 259                            /* Kill all getRequests for a skt */
  104. };
  105.  
  106.  
  107. enum {
  108.                                                                 /* .XPP csCodes */
  109.     openSess                    = 255,                            /* Open session */
  110.     closeSess                    = 254,                            /* Close session */
  111.     userCommand                    = 253,                            /* User command */
  112.     userWrite                    = 252,                            /* User write */
  113.     getStatus                    = 251,                            /* Get status */
  114.     afpCall                        = 250,                            /* AFP command (buffer has command code) */
  115.     getParms                    = 249,                            /* Get parameters */
  116.     abortOS                        = 248,                            /* Abort open session request */
  117.     closeAll                    = 247,                            /* Close all open sessions */
  118.     xCall                        = 246                            /* .XPP extended calls */
  119. };
  120.  
  121.  
  122. enum {
  123.                                                                 /* Transition Queue transition types */
  124.     ATTransOpen                    = 0,                            /*AppleTalk has opened*/
  125.     ATTransClose                = 2,                            /*AppleTalk is about to close*/
  126.     ATTransClosePrep            = 3,                            /*Is it OK to close AppleTalk ?*/
  127.     ATTransCancelClose            = 4                                /*Cancel the ClosePrep transition*/
  128. };
  129.  
  130.  
  131. enum {
  132.     afpByteRangeLock            = 1,                            /*AFPCall command codes*/
  133.     afpVolClose                    = 2,                            /*AFPCall command codes*/
  134.     afpDirClose                    = 3,                            /*AFPCall command codes*/
  135.     afpForkClose                = 4,                            /*AFPCall command codes*/
  136.     afpCopyFile                    = 5,                            /*AFPCall command codes*/
  137.     afpDirCreate                = 6,                            /*AFPCall command codes*/
  138.     afpFileCreate                = 7,                            /*AFPCall command codes*/
  139.     afpDelete                    = 8,                            /*AFPCall command codes*/
  140.     afpEnumerate                = 9,                            /*AFPCall command codes*/
  141.     afpFlush                    = 10,                            /*AFPCall command codes*/
  142.     afpForkFlush                = 11,                            /*AFPCall command codes*/
  143.     afpGetDirParms                = 12,                            /*AFPCall command codes*/
  144.     afpGetFileParms                = 13,                            /*AFPCall command codes*/
  145.     afpGetForkParms                = 14,                            /*AFPCall command codes*/
  146.     afpGetSInfo                    = 15,                            /*AFPCall command codes*/
  147.     afpGetSParms                = 16,                            /*AFPCall command codes*/
  148.     afpGetVolParms                = 17,                            /*AFPCall command codes*/
  149.     afpLogin                    = 18,                            /*AFPCall command codes*/
  150.     afpContLogin                = 19,                            /*AFPCall command codes*/
  151.     afpLogout                    = 20,                            /*AFPCall command codes*/
  152.     afpMapID                    = 21,                            /*AFPCall command codes*/
  153.     afpMapName                    = 22,                            /*AFPCall command codes*/
  154.     afpMove                        = 23,                            /*AFPCall command codes*/
  155.     afpOpenVol                    = 24,                            /*AFPCall command codes*/
  156.     afpOpenDir                    = 25,                            /*AFPCall command codes*/
  157.     afpOpenFork                    = 26,                            /*AFPCall command codes*/
  158.     afpRead                        = 27,                            /*AFPCall command codes*/
  159.     afpRename                    = 28,                            /*AFPCall command codes*/
  160.     afpSetDirParms                = 29,                            /*AFPCall command codes*/
  161.     afpSetFileParms                = 30,                            /*AFPCall command codes*/
  162.     afpSetForkParms                = 31,                            /*AFPCall command codes*/
  163.     afpSetVolParms                = 32,                            /*AFPCall command codes*/
  164.     afpWrite                    = 33,                            /*AFPCall command codes*/
  165.     afpGetFlDrParms                = 34,                            /*AFPCall command codes*/
  166.     afpSetFlDrParms                = 35,                            /*AFPCall command codes*/
  167.     afpDTOpen                    = 48,                            /*AFPCall command codes*/
  168.     afpDTClose                    = 49,                            /*AFPCall command codes*/
  169.     afpGetIcon                    = 51,                            /*AFPCall command codes*/
  170.     afpGtIcnInfo                = 52,                            /*AFPCall command codes*/
  171.     afpAddAPPL                    = 53,                            /*AFPCall command codes*/
  172.     afpRmvAPPL                    = 54,                            /*AFPCall command codes*/
  173.     afpGetAPPL                    = 55,                            /*AFPCall command codes*/
  174.     afpAddCmt                    = 56,                            /*AFPCall command codes*/
  175.     afpRmvCmt                    = 57,                            /*AFPCall command codes*/
  176.     afpGetCmt                    = 58,                            /*AFPCall command codes*/
  177.     afpAddIcon                    = 192                            /*Special code for ASP Write commands*/
  178. };
  179.  
  180.  
  181. enum {
  182.     xppLoadedBit                = 5,                            /* XPP bit in PortBUse */
  183.     scbMemSize                    = 192,                            /* Size of memory for SCB */
  184.     xppFlagClr                    = 0                                /* Cs for AFPCommandBlock */
  185. };
  186.  
  187.  
  188. enum {
  189.     xppFlagSet                    = 128                            /* StartEndFlag & NewLineFlag fields. */
  190. };
  191.  
  192.  
  193. enum {
  194.     lapSize                        = 20,
  195.     ddpSize                        = 26,
  196.     nbpSize                        = 26,
  197.     atpSize                        = 56
  198. };
  199.  
  200.  
  201. enum {
  202.     atpXOvalue                    = 32,                            /*ATP exactly-once bit */
  203.     atpEOMvalue                    = 16,                            /*ATP End-Of-Message bit */
  204.     atpSTSvalue                    = 8,                            /*ATP Send-Transmission-Status bit */
  205.     atpTIDValidvalue            = 2,                            /*ATP trans. ID valid bit */
  206.     atpSendChkvalue                = 1                                /*ATP send checksum bit */
  207. };
  208.  
  209.  
  210. enum {
  211.     zipGetLocalZones            = 5,
  212.     zipGetZoneList                = 6,
  213.     zipGetMyZone                = 7
  214. };
  215.  
  216.  
  217. enum {
  218.     LAPMgrPtr                    = 0x0B18                        /*Entry point for LAP Manager*/
  219. };
  220.  
  221.  
  222. enum {
  223.     LAPMgrCall                    = 2,                            /*Offset to LAP routines*/
  224.     LAddAEQ                        = 23,                            /*LAPAddATQ routine selector*/
  225.     LRmvAEQ                        = 24                            /*LAPRmvATQ routine selector*/
  226. };
  227.  
  228. #define MPPioCompletion MPP.ioCompletion
  229. #define MPPioResult MPP.ioResult
  230. #define MPPioRefNum MPP.ioRefNum
  231. #define MPPcsCode MPP.csCode
  232. #define LAPprotType LAP.protType
  233. #define LAPwdsPointer LAP.u.wdsPointer
  234. #define LAPhandler LAP.u.handler
  235. #define DDPsocket DDP.socket
  236. #define DDPchecksumFlag DDP.checksumFlag
  237. #define DDPwdsPointer DDP.u.wdsPointer
  238. #define DDPlistener DDP.u.listener
  239. #define NBPinterval NBP.interval
  240. #define NBPcount NBP.count
  241. #define NBPntQElPtr NBP.nbpPtrs.ntQElPtr
  242. #define NBPentityPtr NBP.nbpPtrs.entityPtr
  243. #define NBPverifyFlag NBP.parm.verifyFlag
  244. #define NBPretBuffPtr NBP.parm.Lookup.retBuffPtr
  245. #define NBPretBuffSize NBP.parm.Lookup.retBuffSize
  246. #define NBPmaxToGet NBP.parm.Lookup.maxToGet
  247. #define NBPnumGotten NBP.parm.Lookup.numGotten
  248. #define NBPconfirmAddr NBP.parm.Confirm.confirmAddr
  249. #define NBPnKillQEl NBPKILL.nKillQEl
  250. #define NBPnewSocket NBP.parm.Confirm.newSocket
  251. #define ATPioCompletion ATP.ioCompletion
  252. #define ATPioResult ATP.ioResult
  253. #define ATPuserData ATP.userData
  254. #define ATPreqTID ATP.reqTID
  255. #define ATPioRefNum ATP.ioRefNum
  256. #define ATPcsCode ATP.csCode
  257. #define ATPatpSocket ATP.atpSocket
  258. #define ATPatpFlags ATP.atpFlags
  259. #define ATPaddrBlock ATP.addrBlock
  260. #define ATPreqLength ATP.reqLength
  261. #define ATPreqPointer ATP.reqPointer
  262. #define ATPbdsPointer ATP.bdsPointer
  263. #define ATPtimeOutVal SREQ.timeOutVal
  264. #define ATPnumOfResps SREQ.numOfResps
  265. #define ATPretryCount SREQ.retryCount
  266. #define ATPnumOfBuffs OTH1.u.numOfBuffs
  267. #define ATPbitMap OTH1.u.bitMap
  268. #define ATPrspNum OTH1.u.rspNum
  269. #define ATPbdsSize OTH2.bdsSize
  270. #define ATPtransID OTH2.transID
  271. #define ATPaKillQEl KILL.aKillQEl
  272.  
  273. enum {
  274.     tLAPRead                    = 0,
  275.     tLAPWrite                    = 1,
  276.     tDDPRead                    = 2,
  277.     tDDPWrite                    = 3,
  278.     tNBPLookup                    = 4,
  279.     tNBPConfirm                    = 5,
  280.     tNBPRegister                = 6,
  281.     tATPSndRequest                = 7,
  282.     tATPGetRequest                = 8,
  283.     tATPSdRsp                    = 9,
  284.     tATPAddRsp                    = 10,
  285.     tATPRequest                    = 11,
  286.     tATPResponse                = 12
  287. };
  288.  
  289. typedef SInt8                             ABCallType;
  290.  
  291. enum {
  292.     lapProto                    = 0,
  293.     ddpProto                    = 1,
  294.     nbpProto                    = 2,
  295.     atpProto                    = 3
  296. };
  297.  
  298. typedef UInt8                             ABProtoType;
  299. typedef Byte                             ABByte;
  300.  
  301. struct LAPAdrBlock {
  302.     UInt8                             dstNodeID;
  303.     UInt8                             srcNodeID;
  304.     ABByte                             lapProtType;
  305.     UInt8                             filler;                        /*    Filler for proper byte alignment*/
  306. };
  307. typedef struct LAPAdrBlock                LAPAdrBlock;
  308. typedef struct ATQEntry                 ATQEntry;
  309.  
  310. typedef ATQEntry *                        ATQEntryPtr;
  311. typedef CALLBACK_API_C( long , ATalkTransitionEventProcPtr )(long eventCode, ATQEntryPtr qElem, void *eventParameter);
  312. typedef STACK_UPP_TYPE(ATalkTransitionEventProcPtr)             ATalkTransitionEventUPP;
  313. typedef ATalkTransitionEventUPP         ATalkTransitionEvent;
  314.  
  315. struct ATQEntry {
  316.     struct ATQEntry *                qLink;                        /*next queue entry*/
  317.     short                             qType;                        /*queue type*/
  318.     ATalkTransitionEventUPP         CallAddr;                    /*your routine descriptor*/
  319. };
  320.  
  321. /* 
  322.     Real definition of EntityName is 3 PACKED strings of any length (32 is just an example). No
  323.     offests for Asm since each String address must be calculated by adding length byte to last string ptr.
  324.     In Pascal, String(32) will be 34 bytes long since fields never start on an odd byte unless they are 
  325.     only a byte long. So this will generate correct looking interfaces for Pascal and C, but they will not
  326.     be the same, which is OK since they are not used. 
  327. */
  328.  
  329. struct EntityName {
  330.     Str32Field                         objStr;
  331.     Str32Field                         typeStr;
  332.     Str32Field                         zoneStr;
  333. };
  334. typedef struct EntityName                EntityName;
  335.  
  336. typedef EntityName *                    EntityPtr;
  337.  
  338. struct AddrBlock {
  339.     UInt16                             aNet;
  340.     UInt8                             aNode;
  341.     UInt8                             aSocket;
  342. };
  343. typedef struct AddrBlock                AddrBlock;
  344.  
  345. struct RetransType {
  346.     UInt8                             retransInterval;
  347.     UInt8                             retransCount;
  348. };
  349. typedef struct RetransType                RetransType;
  350.  
  351. struct BDSElement {
  352.     short                             buffSize;
  353.     void *                            buffPtr;
  354.     short                             dataSize;
  355.     long                             userBytes;
  356. };
  357. typedef struct BDSElement                BDSElement;
  358.  
  359. typedef BDSElement                         BDSType[8];
  360. typedef BDSElement *                    BDSPtr;
  361. typedef char                             BitMapType;
  362.  
  363. struct ATLAPRec {
  364.     ABCallType                         abOpcode;
  365.     SInt8                             filler;                        /*    Filler for proper byte alignment*/
  366.     short                             abResult;
  367.     long                             abUserReference;
  368.     LAPAdrBlock                     lapAddress;
  369.     short                             lapReqCount;
  370.     short                             lapActCount;
  371.     void *                            lapDataPtr;
  372. };
  373. typedef struct ATLAPRec                    ATLAPRec;
  374. typedef ATLAPRec *                        ATLAPRecPtr;
  375. typedef ATLAPRecPtr *                    ATLAPRecHandle;
  376.  
  377. struct ATDDPRec {
  378.     ABCallType                         abOpcode;
  379.     SInt8                             filler;                        /*    Filler for proper byte alignment*/
  380.     short                             abResult;
  381.     long                             abUserReference;
  382.     short                             ddpType;
  383.     short                             ddpSocket;
  384.     AddrBlock                         ddpAddress;
  385.     short                             ddpReqCount;
  386.     short                             ddpActCount;
  387.     void *                            ddpDataPtr;
  388.     short                             ddpNodeID;
  389. };
  390. typedef struct ATDDPRec                    ATDDPRec;
  391. typedef ATDDPRec *                        ATDDPRecPtr;
  392. typedef ATDDPRecPtr *                    ATDDPRecHandle;
  393.  
  394. struct ATNBPRec {
  395.     ABCallType                         abOpcode;
  396.     SInt8                             filler;                        /*    Filler for proper byte alignment*/
  397.     short                             abResult;
  398.     long                             abUserReference;
  399.     EntityPtr                         nbpEntityPtr;
  400.     void *                            nbpBufPtr;
  401.     short                             nbpBufSize;
  402.     short                             nbpDataField;
  403.     AddrBlock                         nbpAddress;
  404.     RetransType                     nbpRetransmitInfo;
  405. };
  406. typedef struct ATNBPRec                    ATNBPRec;
  407. typedef ATNBPRec *                        ATNBPRecPtr;
  408. typedef ATNBPRecPtr *                    ATNBPRecHandle;
  409.  
  410. struct ATATPRec {
  411.     ABCallType                         abOpcode;
  412.     SInt8                             filler1;                    /*    Filler for proper byte alignment*/
  413.     short                             abResult;
  414.     long                             abUserReference;
  415.     short                             atpSocket;
  416.     AddrBlock                         atpAddress;
  417.     short                             atpReqCount;
  418.     void *                            atpDataPtr;
  419.     BDSPtr                             atpRspBDSPtr;
  420.     BitMapType                         atpBitMap;
  421.     SInt8                             filler2;                    /*    Filler for proper byte alignment*/
  422.     short                             atpTransID;
  423.     short                             atpActCount;
  424.     long                             atpUserData;
  425.     Boolean                         atpXO;
  426.     Boolean                         atpEOM;
  427.     short                             atpTimeOut;
  428.     short                             atpRetries;
  429.     short                             atpNumBufs;
  430.     short                             atpNumRsp;
  431.     short                             atpBDSSize;
  432.     long                             atpRspUData;
  433.     void *                            atpRspBuf;
  434.     short                             atpRspSize;
  435. };
  436. typedef struct ATATPRec                    ATATPRec;
  437. typedef ATATPRec *                        ATATPRecPtr;
  438. typedef ATATPRecPtr *                    ATATPRecHandle;
  439.  
  440. struct AFPCommandBlock {
  441.     UInt8                             cmdByte;
  442.     UInt8                             startEndFlag;
  443.     short                             forkRefNum;
  444.     long                             rwOffset;
  445.     long                             reqCount;
  446.     UInt8                             newLineFlag;
  447.     char                             newLineChar;
  448. };
  449. typedef struct AFPCommandBlock            AFPCommandBlock;
  450. typedef union MPPParamBlock             MPPParamBlock;
  451. typedef union ATPParamBlock             ATPParamBlock;
  452. typedef union XPPParamBlock             XPPParamBlock;
  453.  
  454. typedef MPPParamBlock *                    MPPPBPtr;
  455. typedef ATPParamBlock *                    ATPPBPtr;
  456. typedef XPPParamBlock *                    XPPParmBlkPtr;
  457. typedef CALLBACK_API( void , MPPCompletionProcPtr )(MPPPBPtr thePBptr);
  458. /*
  459.     WARNING: MPPCompletionProcPtr uses register based parameters under classic 68k
  460.              and cannot be written in a high-level language without 
  461.              the help of mixed mode or assembly glue.
  462. */
  463. typedef CALLBACK_API( void , ATPCompletionProcPtr )(ATPPBPtr thePBptr);
  464. /*
  465.     WARNING: ATPCompletionProcPtr uses register based parameters under classic 68k
  466.              and cannot be written in a high-level language without 
  467.              the help of mixed mode or assembly glue.
  468. */
  469. typedef CALLBACK_API( void , XPPCompletionProcPtr )(XPPParmBlkPtr thePBptr);
  470. /*
  471.     WARNING: XPPCompletionProcPtr uses register based parameters under classic 68k
  472.              and cannot be written in a high-level language without 
  473.              the help of mixed mode or assembly glue.
  474. */
  475. typedef CALLBACK_API( void , AttnRoutineProcPtr )(short sessRefnum, short attnBytes);
  476. /*
  477.     WARNING: AttnRoutineProcPtr uses register based parameters under classic 68k
  478.              and cannot be written in a high-level language without 
  479.              the help of mixed mode or assembly glue.
  480. */
  481. typedef REGISTER_UPP_TYPE(MPPCompletionProcPtr)                 MPPCompletionUPP;
  482. typedef REGISTER_UPP_TYPE(ATPCompletionProcPtr)                 ATPCompletionUPP;
  483. typedef REGISTER_UPP_TYPE(XPPCompletionProcPtr)                 XPPCompletionUPP;
  484. typedef REGISTER_UPP_TYPE(AttnRoutineProcPtr)                     AttnRoutineUPP;
  485.  
  486.  
  487. struct WDSElement {
  488.     short                             entryLength;
  489.     Ptr                             entryPtr;
  490. };
  491. typedef struct WDSElement                WDSElement;
  492.  
  493. struct NTElement {
  494.     AddrBlock                         nteAddress;                    /*network address of entity*/
  495.     SInt8                             filler;
  496.     SInt8                             entityData[99];                /*Object, Type & Zone*/
  497. };
  498. typedef struct NTElement                NTElement;
  499.  
  500. struct NamesTableEntry {
  501.     Ptr                             qNext;                        /*ptr to next NTE*/
  502.     NTElement                         nt;
  503. };
  504. typedef struct NamesTableEntry            NamesTableEntry;
  505. typedef CALLBACK_API( Boolean , MPPProtocolHandlerProcPtr )(Ptr SCCAddr1, Ptr SCCAddr2, Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, short numBytesLeftToReadInPacket);
  506. /*
  507.     WARNING: MPPProtocolHandlerProcPtr uses register based parameters under classic 68k
  508.              and cannot be written in a high-level language without 
  509.              the help of mixed mode or assembly glue.
  510. */
  511. typedef CALLBACK_API( Boolean , DDPSocketListenerProcPtr )(Ptr SCCAddr1, Ptr SCCAddr2, Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, UInt8 packetDestinationNumber, short numBytesLeftToReadInPacket);
  512. /*
  513.     WARNING: DDPSocketListenerProcPtr uses register based parameters under classic 68k
  514.              and cannot be written in a high-level language without 
  515.              the help of mixed mode or assembly glue.
  516. */
  517. typedef REGISTER_UPP_TYPE(MPPProtocolHandlerProcPtr)             MPPProtocolHandlerUPP;
  518. typedef REGISTER_UPP_TYPE(DDPSocketListenerProcPtr)             DDPSocketListenerUPP;
  519. /*
  520.     MPPProtocolHandlerProcs and  DDPSocketListenerProcs cannot be written 
  521.     in or called from a high-level language without the help of mixed mode 
  522.     or assembly glue because they use the following parameter-passing conventions:
  523.  
  524.     typedef Boolean (*MPPProtocolHandlerProcPtr)(Ptr SCCAddr1, Ptr SCCAddr2, 
  525.             Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, 
  526.             short numBytesLeftToReadInPacket);
  527.  
  528.         In:
  529.             =>    SCCAddr1                    A0.L
  530.             =>    SCCAddr2                    A1.L
  531.             =>    MPPLocalVars                A2.L
  532.             =>    nextFreeByteInRHA            A3.L
  533.             =>    ReadPacketAndReadRestPtr    A4.L
  534.             =>    numBytesLeftToReadInPacket    D1.W
  535.         Out:
  536.             <=    Boolean                        Z bit of CCR
  537.  
  538.     typedef Boolean (*DDPSocketListenerProcPtr)(Ptr SCCAddr1, Ptr SCCAddr2, 
  539.             Ptr MPPLocalVars, Ptr nextFreeByteInRHA, Ptr ReadPacketAndReadRestPtr, 
  540.             UInt8 packetDestinationNumber, short numBytesLeftToReadInPacket);
  541.  
  542.         In:
  543.             =>    SCCAddr1                    A0.L
  544.             =>    SCCAddr2                    A1.L
  545.             =>    MPPLocalVars                A2.L
  546.             =>    nextFreeByteInRHA            A3.L
  547.             =>    ReadPacketAndReadRestPtr    A4.L
  548.             =>    packetDestinationNumber        D0.B
  549.             =>    numBytesLeftToReadInPacket    D1.W
  550.         Out:
  551.             <=    Boolean                        Z bit of CCR
  552.  
  553. */
  554.  
  555. struct MPPparms {
  556.     QElem *                            qLink;                        /*next queue entry*/
  557.     short                             qType;                        /*queue type*/
  558.     short                             ioTrap;                        /*routine trap*/
  559.     Ptr                             ioCmdAddr;                    /*routine address*/
  560.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  561.     OSErr                             ioResult;                    /*result code*/
  562.     long                             userData;                    /*Command result (ATP user bytes)*/
  563.     short                             reqTID;                        /*request transaction ID*/
  564.     short                             ioRefNum;                    /*driver reference number*/
  565.     short                             csCode;                        /*Call command code*/
  566. };
  567. typedef struct MPPparms                    MPPparms;
  568.  
  569. struct LAPparms {
  570.     QElem *                            qLink;                        /*next queue entry*/
  571.     short                             qType;                        /*queue type*/
  572.     short                             ioTrap;                        /*routine trap*/
  573.     Ptr                             ioCmdAddr;                    /*routine address*/
  574.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  575.     OSErr                             ioResult;                    /*result code*/
  576.     long                             userData;                    /*Command result (ATP user bytes)*/
  577.     short                             reqTID;                        /*request transaction ID*/
  578.     short                             ioRefNum;                    /*driver reference number*/
  579.     short                             csCode;                        /*Call command code*/
  580.     UInt8                             protType;                    /*ALAP protocol Type */
  581.     UInt8                             filler;
  582.     union {
  583.         void *                            wdsPointer;                /*-> write data structure*/
  584.         MPPProtocolHandlerUPP             handler;                /*-> protocol handler routine*/
  585.     }                                 u;
  586. };
  587. typedef struct LAPparms                    LAPparms;
  588.  
  589. struct DDPparms {
  590.     QElem *                            qLink;                        /*next queue entry*/
  591.     short                             qType;                        /*queue type*/
  592.     short                             ioTrap;                        /*routine trap*/
  593.     Ptr                             ioCmdAddr;                    /*routine address*/
  594.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  595.     OSErr                             ioResult;                    /*result code*/
  596.     long                             userData;                    /*Command result (ATP user bytes)*/
  597.     short                             reqTID;                        /*request transaction ID*/
  598.     short                             ioRefNum;                    /*driver reference number*/
  599.     short                             csCode;                        /*Call command code*/
  600.     UInt8                             socket;                        /*socket number */
  601.     UInt8                             checksumFlag;                /*check sum flag */
  602.     union {
  603.         void *                            wdsPointer;                /*-> write data structure*/
  604.         DDPSocketListenerUPP             listener;                /*->write data structure or -> Listener*/
  605.     }                                 u;
  606. };
  607. typedef struct DDPparms                    DDPparms;
  608.  
  609. union NBPPtrs {
  610.     Ptr                             ntQElPtr;
  611.     Ptr                             entityPtr;
  612. };
  613. typedef union NBPPtrs                    NBPPtrs;
  614.  
  615. union LookupConfirmParams {
  616.     UInt8                             verifyFlag;
  617.     struct {
  618.         void *                            retBuffPtr;
  619.         short                             retBuffSize;
  620.         short                             maxToGet;
  621.         short                             numGotten;
  622.     }                                 Lookup;
  623.     struct {
  624.         AddrBlock                         confirmAddr;
  625.         UInt8                             newSocket;
  626.         SInt8                             filler;                    /*    Filler for proper byte alignment*/
  627.     }                                 Confirm;
  628. };
  629. typedef union LookupConfirmParams        LookupConfirmParams;
  630.  
  631. struct NBPparms {
  632.     QElem *                            qLink;                        /*next queue entry*/
  633.     short                             qType;                        /*queue type*/
  634.     short                             ioTrap;                        /*routine trap*/
  635.     Ptr                             ioCmdAddr;                    /*routine address*/
  636.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  637.     OSErr                             ioResult;                    /*result code*/
  638.     long                             userData;                    /*Command result (ATP user bytes)*/
  639.     short                             reqTID;                        /*request transaction ID*/
  640.     short                             ioRefNum;                    /*driver reference number*/
  641.     short                             csCode;                        /*Call command code*/
  642.     UInt8                             interval;                    /*retry interval */
  643.     UInt8                             count;                        /*retry count */
  644.     NBPPtrs                         nbpPtrs;
  645.     LookupConfirmParams             parm;
  646. };
  647. typedef struct NBPparms                    NBPparms;
  648.  
  649. struct SetSelfparms {
  650.     QElem *                            qLink;                        /*next queue entry*/
  651.     short                             qType;                        /*queue type*/
  652.     short                             ioTrap;                        /*routine trap*/
  653.     Ptr                             ioCmdAddr;                    /*routine address*/
  654.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  655.     OSErr                             ioResult;                    /*result code*/
  656.     long                             userData;                    /*Command result (ATP user bytes)*/
  657.     short                             reqTID;                        /*request transaction ID*/
  658.     short                             ioRefNum;                    /*driver reference number*/
  659.     short                             csCode;                        /*Call command code*/
  660.     UInt8                             newSelfFlag;                /*self-send toggle flag */
  661.     UInt8                             oldSelfFlag;                /*previous self-send state */
  662. };
  663. typedef struct SetSelfparms                SetSelfparms;
  664.  
  665. struct NBPKillparms {
  666.     QElem *                            qLink;                        /*next queue entry*/
  667.     short                             qType;                        /*queue type*/
  668.     short                             ioTrap;                        /*routine trap*/
  669.     Ptr                             ioCmdAddr;                    /*routine address*/
  670.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  671.     OSErr                             ioResult;                    /*result code*/
  672.     long                             userData;                    /*Command result (ATP user bytes)*/
  673.     short                             reqTID;                        /*request transaction ID*/
  674.     short                             ioRefNum;                    /*driver reference number*/
  675.     short                             csCode;                        /*Call command code*/
  676.     void *                            nKillQEl;                    /*ptr to i/o queue element to cancel */
  677. };
  678. typedef struct NBPKillparms                NBPKillparms;
  679.  
  680.  
  681. struct GetAppleTalkInfoParm {
  682.     QElem *                            qLink;                        /*next queue entry*/
  683.     short                             qType;                        /*queue type*/
  684.     short                             ioTrap;                        /*routine trap*/
  685.     Ptr                             ioCmdAddr;                    /*routine address*/
  686.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  687.     OSErr                             ioResult;                    /*result code*/
  688.     long                             userData;                    /*Command result (ATP user bytes)*/
  689.     short                             reqTID;                        /*request transaction ID*/
  690.     short                             ioRefNum;                    /*driver reference number*/
  691.     short                             csCode;                        /*Call command code*/
  692.                                                                 /*max. concurrent NBP requests*/
  693.     short                             version;                    /*requested info version*/
  694.     void *                            varsPtr;                    /*pointer to well known MPP vars*/
  695.     void *                            DCEPtr;                        /*pointer to MPP DCE*/
  696.     short                             portID;                        /*port number [0..7]*/
  697.     long                             configuration;                /*32-bit configuration word*/
  698.     short                             selfSend;                    /*non zero if SelfSend enabled*/
  699.     short                             netLo;                        /*low value of network range*/
  700.     short                             netHi;                        /*high value of network range*/
  701.     long                             ourAdd;                        /*our 24-bit AppleTalk address*/
  702.     long                             routerAddr;                    /*24-bit address of (last) router*/
  703.     short                             numOfPHs;                    /*max. number of protocol handlers*/
  704.     short                             numOfSkts;                    /*max. number of static sockets*/
  705.     short                             numNBPEs;                    /*max. concurrent NBP requests*/
  706.     void *                            nTQueue;                    /*pointer to registered name queue*/
  707.     short                             LAlength;                    /*length in bytes of data link addr*/
  708.     void *                            linkAddr;                    /*data link address returned*/
  709.     Ptr                             zoneName;                    /*zone name returned*/
  710. };
  711. typedef struct GetAppleTalkInfoParm        GetAppleTalkInfoParm;
  712.  
  713. struct ATalkClosePrepParm {
  714.     QElem *                            qLink;                        /*next queue entry*/
  715.     short                             qType;                        /*queue type*/
  716.     short                             ioTrap;                        /*routine trap*/
  717.     Ptr                             ioCmdAddr;                    /*routine address*/
  718.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  719.     OSErr                             ioResult;                    /*result code*/
  720.     long                             userData;                    /*Command result (ATP user bytes)*/
  721.     short                             reqTID;                        /*request transaction ID*/
  722.     short                             ioRefNum;                    /*driver reference number*/
  723.     short                             csCode;                        /*Call command code*/
  724.     Ptr                             appName;                    /*pointer to application name in buffer*/
  725. };
  726. typedef struct ATalkClosePrepParm        ATalkClosePrepParm;
  727.  
  728. union MPPParamBlock {
  729.     MPPparms                         MPP;                        /*General MPP parms*/
  730.     LAPparms                         LAP;                        /*ALAP calls*/
  731.     DDPparms                         DDP;                        /*DDP calls*/
  732.     NBPparms                         NBP;                        /*NBP calls*/
  733.     SetSelfparms                     SETSELF;
  734.     NBPKillparms                     NBPKILL;
  735.     GetAppleTalkInfoParm             GAIINFO;
  736.     ATalkClosePrepParm                 ATALKCLOSE;
  737. };
  738.  
  739.  
  740.  
  741. struct XPPPrmBlk {
  742.     QElem *                            qLink;
  743.     short                             qType;
  744.     short                             ioTrap;
  745.     Ptr                             ioCmdAddr;
  746.     XPPCompletionUPP                 ioCompletion;
  747.     OSErr                             ioResult;
  748.     long                             cmdResult;
  749.     short                             ioVRefNum;
  750.     short                             ioRefNum;
  751.     short                             csCode;
  752.     short                             sessRefnum;                    /*Offset to session refnum */
  753.     UInt8                             aspTimeout;                    /*Timeout for ATP */
  754.     UInt8                             aspRetry;                    /*Retry count for ATP */
  755.     short                             cbSize;                        /*Command block size */
  756.     Ptr                             cbPtr;                        /*Command block pointer */
  757.     short                             rbSize;                        /*Reply buffer size */
  758.     Ptr                             rbPtr;                        /*Reply buffer pointer */
  759.     short                             wdSize;                        /*Write Data size*/
  760.     Ptr                             wdPtr;                        /*Write Data pointer*/
  761.     UInt8                             ccbStart[296];                /*CCB memory allocated for driver afpWrite max size(CCB)=296 all other calls=150*/
  762. };
  763. typedef struct XPPPrmBlk                XPPPrmBlk;
  764.  
  765. struct ASPGetparmsBlk {
  766.     QElem *                            qLink;
  767.     short                             qType;
  768.     short                             ioTrap;
  769.     Ptr                             ioCmdAddr;
  770.     XPPCompletionUPP                 ioCompletion;
  771.     OSErr                             ioResult;
  772.     long                             cmdResult;
  773.     short                             ioVRefNum;
  774.     short                             ioRefNum;
  775.     short                             csCode;
  776.     short                             aspMaxCmdSize;                /*For SPGetParms*/
  777.     short                             aspQuantumSize;
  778.     short                             numSesss;
  779. };
  780. typedef struct ASPGetparmsBlk            ASPGetparmsBlk;
  781.  
  782. struct ASPAbortPrm {
  783.     QElem *                            qLink;
  784.     short                             qType;
  785.     short                             ioTrap;
  786.     Ptr                             ioCmdAddr;
  787.     XPPCompletionUPP                 ioCompletion;
  788.     OSErr                             ioResult;
  789.     long                             cmdResult;
  790.     short                             ioVRefNum;
  791.     short                             ioRefNum;
  792.     short                             csCode;
  793.     Ptr                             abortSCBPtr;                /*SCB pointer for AbortOS */
  794. };
  795. typedef struct ASPAbortPrm                ASPAbortPrm;
  796.  
  797. struct ASPOpenPrm {
  798.     QElem *                            qLink;
  799.     short                             qType;
  800.     short                             ioTrap;
  801.     Ptr                             ioCmdAddr;
  802.     XPPCompletionUPP                 ioCompletion;
  803.     OSErr                             ioResult;
  804.     long                             cmdResult;
  805.     short                             ioVRefNum;
  806.     short                             ioRefNum;
  807.     short                             csCode;
  808.     short                             sessRefnum;                    /*Offset to session refnum */
  809.     UInt8                             aspTimeout;                    /*Timeout for ATP */
  810.     UInt8                             aspRetry;                    /*Retry count for ATP */
  811.     AddrBlock                         serverAddr;                    /*Server address block */
  812.     Ptr                             scbPointer;                    /*SCB pointer */
  813.     AttnRoutineUPP                     attnRoutine;                /*Attention routine pointer*/
  814. };
  815. typedef struct ASPOpenPrm                ASPOpenPrm;
  816. typedef ASPOpenPrm *                    ASPOpenPrmPtr;
  817.  
  818. struct AFPLoginPrm {
  819.     QElem *                            qLink;
  820.     short                             qType;
  821.     short                             ioTrap;
  822.     Ptr                             ioCmdAddr;
  823.     XPPCompletionUPP                 ioCompletion;
  824.     OSErr                             ioResult;
  825.     long                             cmdResult;
  826.     short                             ioVRefNum;
  827.     short                             ioRefNum;
  828.     short                             csCode;
  829.     short                             sessRefnum;                    /*Offset to session refnum */
  830.     UInt8                             aspTimeout;                    /*Timeout for ATP */
  831.     UInt8                             aspRetry;                    /*Retry count for ATP */
  832.     short                             cbSize;                        /*Command block size */
  833.     void *                            cbPtr;                        /*Command block pointer */
  834.     short                             rbSize;                        /*Reply buffer size */
  835.     void *                            rbPtr;                        /*Reply buffer pointer */
  836.     AddrBlock                         afpAddrBlock;                /*block in AFP login */
  837.     void *                            afpSCBPtr;                    /*SCB pointer in AFP login */
  838.     AttnRoutineUPP                     afpAttnRoutine;                /*routine pointer in AFP login */
  839.     UInt8                             ccbFill[144];                /*CCB memory allocated for driver  Login needs only 150 bytes BUT CCB really starts in the middle of AFPSCBPtr and also clobbers AFPAttnRoutine. */
  840. };
  841. typedef struct AFPLoginPrm                AFPLoginPrm;
  842.  
  843. struct XCallParam {
  844.     QElem *                            qLink;
  845.     short                             qType;
  846.     short                             ioTrap;
  847.     Ptr                             ioCmdAddr;
  848.     XPPCompletionUPP                 ioCompletion;
  849.     OSErr                             ioResult;
  850.     long                             cmdResult;
  851.     short                             ioVRefNum;
  852.     short                             ioRefNum;
  853.     short                             csCode;
  854.     short                             xppSubCode;
  855.     UInt8                             xppTimeout;                    /*retry interval (seconds)*/
  856.     UInt8                             xppRetry;                    /*retry count*/
  857.     short                             filler1;
  858.     void *                            zipBuffPtr;                    /*pointer to buffer (must be 578 bytes)*/
  859.     short                             zipNumZones;                /*no. of zone names in this response*/
  860.     UInt8                             zipLastFlag;                /*non-zero if no more zones*/
  861.     UInt8                             filler2;                    /*filler*/
  862.     UInt8                             zipInfoField[70];            /*on initial call, set first word to zero*/
  863. };
  864. typedef struct XCallParam                XCallParam;
  865.  
  866. union XPPParamBlock {
  867.     XPPPrmBlk                         XPP;
  868.     ASPGetparmsBlk                     GETPARM;
  869.     ASPAbortPrm                     ABORT;
  870.     ASPOpenPrm                         OPEN;
  871.     AFPLoginPrm                     LOGIN;
  872.     XCallParam                         XCALL;
  873. };
  874.  
  875.  
  876. struct ATPparms {
  877.     QElem *                            qLink;                        /*next queue entry*/
  878.     short                             qType;                        /*queue type*/
  879.     short                             ioTrap;                        /*routine trap*/
  880.     Ptr                             ioCmdAddr;                    /*routine address*/
  881.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  882.     OSErr                             ioResult;                    /*result code*/
  883.     long                             userData;                    /*Command result (ATP user bytes)*/
  884.     short                             reqTID;                        /*request transaction ID*/
  885.     short                             ioRefNum;                    /*driver reference number*/
  886.     short                             csCode;                        /*Call command code*/
  887.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  888.     UInt8                             atpFlags;                    /*control information*/
  889.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  890.     short                             reqLength;                    /*request/response length*/
  891.     void *                            reqPointer;                    /*->request/response Data*/
  892.     void *                            bdsPointer;                    /*->response BDS */
  893. };
  894. typedef struct ATPparms                    ATPparms;
  895.  
  896. struct SendReqparms {
  897.     QElem *                            qLink;                        /*next queue entry*/
  898.     short                             qType;                        /*queue type*/
  899.     short                             ioTrap;                        /*routine trap*/
  900.     Ptr                             ioCmdAddr;                    /*routine address*/
  901.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  902.     OSErr                             ioResult;                    /*result code*/
  903.     long                             userData;                    /*Command result (ATP user bytes)*/
  904.     short                             reqTID;                        /*request transaction ID*/
  905.     short                             ioRefNum;                    /*driver reference number*/
  906.     short                             csCode;                        /*Call command code*/
  907.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  908.     UInt8                             atpFlags;                    /*control information*/
  909.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  910.     short                             reqLength;                    /*request/response length*/
  911.     void *                            reqPointer;                    /*->request/response Data*/
  912.     void *                            bdsPointer;                    /*->response BDS */
  913.     UInt8                             numOfBuffs;                    /*numOfBuffs */
  914.     UInt8                             timeOutVal;                    /*timeout interval */
  915.     UInt8                             numOfResps;                    /*number of responses actually received */
  916.     UInt8                             retryCount;                    /*number of retries */
  917.     short                             intBuff;                    /*used internally for NSendRequest */
  918.     UInt8                             TRelTime;                    /*TRelease time for extended send request */
  919.     SInt8                             filler0;
  920. };
  921. typedef struct SendReqparms                SendReqparms;
  922.  
  923.  
  924. struct ATPmisc1 {
  925.     QElem *                            qLink;                        /*next queue entry*/
  926.     short                             qType;                        /*queue type*/
  927.     short                             ioTrap;                        /*routine trap*/
  928.     Ptr                             ioCmdAddr;                    /*routine address*/
  929.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  930.     OSErr                             ioResult;                    /*result code*/
  931.     long                             userData;                    /*Command result (ATP user bytes)*/
  932.     short                             reqTID;                        /*request transaction ID*/
  933.     short                             ioRefNum;                    /*driver reference number*/
  934.     short                             csCode;                        /*Call command code*/
  935.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  936.     UInt8                             atpFlags;                    /*control information*/
  937.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  938.     short                             reqLength;                    /*request/response length*/
  939.     void *                            reqPointer;                    /*->request/response Data*/
  940.     void *                            bdsPointer;                    /*->response BDS */
  941.     union {
  942.         UInt8                             bitMap;                    /*bitmap received */
  943.         UInt8                             numOfBuffs;                /*number of responses being sent*/
  944.         UInt8                             rspNum;                    /*sequence number*/
  945.     }                                 u;
  946. };
  947. typedef struct ATPmisc1                    ATPmisc1;
  948.  
  949. struct ATPmisc2 {
  950.     QElem *                            qLink;                        /*next queue entry*/
  951.     short                             qType;                        /*queue type*/
  952.     short                             ioTrap;                        /*routine trap*/
  953.     Ptr                             ioCmdAddr;                    /*routine address*/
  954.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  955.     OSErr                             ioResult;                    /*result code*/
  956.     long                             userData;                    /*Command result (ATP user bytes)*/
  957.     short                             reqTID;                        /*request transaction ID*/
  958.     short                             ioRefNum;                    /*driver reference number*/
  959.     short                             csCode;                        /*Call command code*/
  960.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  961.     UInt8                             atpFlags;                    /*control information*/
  962.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  963.     short                             reqLength;                    /*request/response length*/
  964.     void *                            reqPointer;                    /*->request/response Data*/
  965.     void *                            bdsPointer;                    /*->response BDS */
  966.     UInt8                             filler;
  967.     UInt8                             bdsSize;                    /*number of BDS elements */
  968.     short                             transID;                    /*transaction ID recd. */
  969. };
  970. typedef struct ATPmisc2                    ATPmisc2;
  971.  
  972. struct Killparms {
  973.     QElem *                            qLink;                        /*next queue entry*/
  974.     short                             qType;                        /*queue type*/
  975.     short                             ioTrap;                        /*routine trap*/
  976.     Ptr                             ioCmdAddr;                    /*routine address*/
  977.     ATPCompletionUPP                 ioCompletion;                /*ATPCompletionUPP or MPPCompletionUPP*/
  978.     OSErr                             ioResult;                    /*result code*/
  979.     long                             userData;                    /*Command result (ATP user bytes)*/
  980.     short                             reqTID;                        /*request transaction ID*/
  981.     short                             ioRefNum;                    /*driver reference number*/
  982.     short                             csCode;                        /*Call command code*/
  983.     UInt8                             atpSocket;                    /*currbitmap for requests or ATP socket number*/
  984.     UInt8                             atpFlags;                    /*control information*/
  985.     AddrBlock                         addrBlock;                    /*source/dest. socket address*/
  986.     short                             reqLength;                    /*request/response length*/
  987.     void *                            reqPointer;                    /*->request/response Data*/
  988.     void *                            bdsPointer;                    /*->response BDS */
  989.     void *                            aKillQEl;                    /*ptr to i/o queue element to cancel*/
  990. };
  991. typedef struct Killparms                Killparms;
  992.  
  993. union ATPParamBlock {
  994.     ATPparms                         ATP;                        /*General ATP parms*/
  995.     SendReqparms                     SREQ;                        /*sendrequest parms*/
  996.     ATPmisc1                         OTH1;                        /*and a few others*/
  997.     ATPmisc2                         OTH2;                        /*and a few others*/
  998.     Killparms                         KILL;                        /*and a few others*/
  999. };
  1000.  
  1001. enum { uppATalkTransitionEventProcInfo = 0x00000FF1 };             /* 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  1002. enum { uppMPPCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  1003. enum { uppATPCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  1004. enum { uppXPPCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  1005. enum { uppAttnRoutineProcInfo = 0x00061002 };                     /* register no_return_value Func(2_bytes:D0, 2_bytes:D1) */
  1006. enum { uppMPPProtocolHandlerProcInfo = 0x0000007F };             /* SPECIAL_CASE_PROCINFO(7) */
  1007. enum { uppDDPSocketListenerProcInfo = 0x0000008F };             /* SPECIAL_CASE_PROCINFO(8) */
  1008. #define NewATalkTransitionEventProc(userRoutine)                 (ATalkTransitionEventUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATalkTransitionEventProcInfo, GetCurrentArchitecture())
  1009. #define NewMPPCompletionProc(userRoutine)                         (MPPCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMPPCompletionProcInfo, GetCurrentArchitecture())
  1010. #define NewATPCompletionProc(userRoutine)                         (ATPCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATPCompletionProcInfo, GetCurrentArchitecture())
  1011. #define NewXPPCompletionProc(userRoutine)                         (XPPCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppXPPCompletionProcInfo, GetCurrentArchitecture())
  1012. #define NewAttnRoutineProc(userRoutine)                         (AttnRoutineUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAttnRoutineProcInfo, GetCurrentArchitecture())
  1013. #define NewMPPProtocolHandlerProc(userRoutine)                     (MPPProtocolHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMPPProtocolHandlerProcInfo, GetCurrentArchitecture())
  1014. #define NewDDPSocketListenerProc(userRoutine)                     (DDPSocketListenerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDDPSocketListenerProcInfo, GetCurrentArchitecture())
  1015. #define CallATalkTransitionEventProc(userRoutine, eventCode, qElem, eventParameter)  CALL_THREE_PARAMETER_UPP((userRoutine), uppATalkTransitionEventProcInfo, (eventCode), (qElem), (eventParameter))
  1016. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1017.     #pragma parameter CallMPPCompletionProc(__A1, __A0)
  1018.     void CallMPPCompletionProc(MPPCompletionUPP routine, MPPPBPtr thePBptr) = 0x4E91;
  1019. #else
  1020.     #define CallMPPCompletionProc(userRoutine, thePBptr)         CALL_ONE_PARAMETER_UPP((userRoutine), uppMPPCompletionProcInfo, (thePBptr))
  1021. #endif
  1022. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1023.     #pragma parameter CallATPCompletionProc(__A1, __A0)
  1024.     void CallATPCompletionProc(ATPCompletionUPP routine, ATPPBPtr thePBptr) = 0x4E91;
  1025. #else
  1026.     #define CallATPCompletionProc(userRoutine, thePBptr)         CALL_ONE_PARAMETER_UPP((userRoutine), uppATPCompletionProcInfo, (thePBptr))
  1027. #endif
  1028. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1029.     #pragma parameter CallXPPCompletionProc(__A1, __A0)
  1030.     void CallXPPCompletionProc(XPPCompletionUPP routine, XPPParmBlkPtr thePBptr) = 0x4E91;
  1031. #else
  1032.     #define CallXPPCompletionProc(userRoutine, thePBptr)         CALL_ONE_PARAMETER_UPP((userRoutine), uppXPPCompletionProcInfo, (thePBptr))
  1033. #endif
  1034. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1035.     #pragma parameter CallAttnRoutineProc(__A0, __D0, __D1)
  1036.     void CallAttnRoutineProc(AttnRoutineUPP routine, short sessRefnum, short attnBytes) = 0x4E90;
  1037. #else
  1038.     #define CallAttnRoutineProc(userRoutine, sessRefnum, attnBytes)  CALL_TWO_PARAMETER_UPP((userRoutine), uppAttnRoutineProcInfo, (sessRefnum), (attnBytes))
  1039. #endif
  1040. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1041.     /* CallMPPProtocolHandlerProc can't be called from classic 68k without glue code */
  1042. #else
  1043.     #define CallMPPProtocolHandlerProc(userRoutine, SCCAddr1, SCCAddr2, MPPLocalVars, nextFreeByteInRHA, ReadPacketAndReadRestPtr, numBytesLeftToReadInPacket)  CALL_SIX_PARAMETER_UPP((userRoutine), uppMPPProtocolHandlerProcInfo, (SCCAddr1), (SCCAddr2), (MPPLocalVars), (nextFreeByteInRHA), (ReadPacketAndReadRestPtr), (numBytesLeftToReadInPacket))
  1044. #endif
  1045. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1046.     /* CallDDPSocketListenerProc can't be called from classic 68k without glue code */
  1047. #else
  1048.     #define CallDDPSocketListenerProc(userRoutine, SCCAddr1, SCCAddr2, MPPLocalVars, nextFreeByteInRHA, ReadPacketAndReadRestPtr, packetDestinationNumber, numBytesLeftToReadInPacket)  CALL_SEVEN_PARAMETER_UPP((userRoutine), uppDDPSocketListenerProcInfo, (SCCAddr1), (SCCAddr2), (MPPLocalVars), (nextFreeByteInRHA), (ReadPacketAndReadRestPtr), (packetDestinationNumber), (numBytesLeftToReadInPacket))
  1049. #endif
  1050. EXTERN_API( OSErr )
  1051. OpenXPP                            (short *                xppRefnum);
  1052.  
  1053. EXTERN_API( OSErr )
  1054. ASPOpenSession                    (XPPParmBlkPtr             thePBptr,
  1055.                                  Boolean                 async);
  1056.  
  1057. EXTERN_API( OSErr )
  1058. ASPCloseSession                    (XPPParmBlkPtr             thePBptr,
  1059.                                  Boolean                 async);
  1060.  
  1061. EXTERN_API( OSErr )
  1062. ASPAbortOS                        (XPPParmBlkPtr             thePBptr,
  1063.                                  Boolean                 async);
  1064.  
  1065. EXTERN_API( OSErr )
  1066. ASPGetParms                        (XPPParmBlkPtr             thePBptr,
  1067.                                  Boolean                 async);
  1068.  
  1069. EXTERN_API( OSErr )
  1070. ASPCloseAll                        (XPPParmBlkPtr             thePBptr,
  1071.                                  Boolean                 async);
  1072.  
  1073. EXTERN_API( OSErr )
  1074. ASPUserWrite                    (XPPParmBlkPtr             thePBptr,
  1075.                                  Boolean                 async);
  1076.  
  1077. EXTERN_API( OSErr )
  1078. ASPUserCommand                    (XPPParmBlkPtr             thePBptr,
  1079.                                  Boolean                 async);
  1080.  
  1081. EXTERN_API( OSErr )
  1082. ASPGetStatus                    (XPPParmBlkPtr             thePBptr,
  1083.                                  Boolean                 async);
  1084.  
  1085. #define ASPGetStatusSync(paramBlock) ASPGetStatus((paramBlock), false)
  1086. EXTERN_API( OSErr )
  1087. AFPCommand                        (XPPParmBlkPtr             thePBptr,
  1088.                                  Boolean                 async);
  1089.  
  1090. EXTERN_API( OSErr )
  1091. GetLocalZones                    (XPPParmBlkPtr             thePBptr,
  1092.                                  Boolean                 async);
  1093.  
  1094. EXTERN_API( OSErr )
  1095. GetZoneList                        (XPPParmBlkPtr             thePBptr,
  1096.                                  Boolean                 async);
  1097.  
  1098. EXTERN_API( OSErr )
  1099. GetMyZone                        (XPPParmBlkPtr             thePBptr,
  1100.                                  Boolean                 async);
  1101.  
  1102. EXTERN_API( OSErr )
  1103. PAttachPH                        (MPPPBPtr                 thePBptr,
  1104.                                  Boolean                 async);
  1105.  
  1106. EXTERN_API( OSErr )
  1107. PDetachPH                        (MPPPBPtr                 thePBptr,
  1108.                                  Boolean                 async);
  1109.  
  1110. EXTERN_API( OSErr )
  1111. PWriteLAP                        (MPPPBPtr                 thePBptr,
  1112.                                  Boolean                 async);
  1113.  
  1114. EXTERN_API( OSErr )
  1115. POpenSkt                        (MPPPBPtr                 thePBptr,
  1116.                                  Boolean                 async);
  1117.  
  1118. EXTERN_API( OSErr )
  1119. PCloseSkt                        (MPPPBPtr                 thePBptr,
  1120.                                  Boolean                 async);
  1121.  
  1122. EXTERN_API( OSErr )
  1123. PWriteDDP                        (MPPPBPtr                 thePBptr,
  1124.                                  Boolean                 async);
  1125.  
  1126. EXTERN_API( OSErr )
  1127. PRegisterName                    (MPPPBPtr                 thePBptr,
  1128.                                  Boolean                 async);
  1129.  
  1130. EXTERN_API( OSErr )
  1131. PLookupName                        (MPPPBPtr                 thePBptr,
  1132.                                  Boolean                 async);
  1133.  
  1134. #define PLookupNameSync(paramBlock) PLookupName((paramBlock), false)
  1135. EXTERN_API( OSErr )
  1136. PConfirmName                    (MPPPBPtr                 thePBptr,
  1137.                                  Boolean                 async);
  1138.  
  1139. EXTERN_API( OSErr )
  1140. PRemoveName                        (MPPPBPtr                 thePBptr,
  1141.                                  Boolean                 async);
  1142.  
  1143. EXTERN_API( OSErr )
  1144. PSetSelfSend                    (MPPPBPtr                 thePBptr,
  1145.                                  Boolean                 async);
  1146.  
  1147. EXTERN_API( OSErr )
  1148. PKillNBP                        (MPPPBPtr                 thePBptr,
  1149.                                  Boolean                 async);
  1150.  
  1151. EXTERN_API( OSErr )
  1152. PGetAppleTalkInfo                (MPPPBPtr                 thePBptr,
  1153.                                  Boolean                 async);
  1154.  
  1155. EXTERN_API( OSErr )
  1156. PATalkClosePrep                    (MPPPBPtr                 thePBptr,
  1157.                                  Boolean                 async);
  1158.  
  1159. EXTERN_API( OSErr )
  1160. POpenATPSkt                        (ATPPBPtr                 thePBptr,
  1161.                                  Boolean                 async);
  1162.  
  1163. EXTERN_API( OSErr )
  1164. PCloseATPSkt                    (ATPPBPtr                 thePBPtr,
  1165.                                  Boolean                 async);
  1166.  
  1167. EXTERN_API( OSErr )
  1168. PSendRequest                    (ATPPBPtr                 thePBPtr,
  1169.                                  Boolean                 async);
  1170.  
  1171. EXTERN_API( OSErr )
  1172. PGetRequest                        (ATPPBPtr                 thePBPtr,
  1173.                                  Boolean                 async);
  1174.  
  1175. EXTERN_API( OSErr )
  1176. PSendResponse                    (ATPPBPtr                 thePBPtr,
  1177.                                  Boolean                 async);
  1178.  
  1179. EXTERN_API( OSErr )
  1180. PAddResponse                    (ATPPBPtr                 thePBPtr,
  1181.                                  Boolean                 async);
  1182.  
  1183. EXTERN_API( OSErr )
  1184. PRelTCB                            (ATPPBPtr                 thePBPtr,
  1185.                                  Boolean                 async);
  1186.  
  1187. EXTERN_API( OSErr )
  1188. PRelRspCB                        (ATPPBPtr                 thePBPtr,
  1189.                                  Boolean                 async);
  1190.  
  1191. EXTERN_API( OSErr )
  1192. PNSendRequest                    (ATPPBPtr                 thePBPtr,
  1193.                                  Boolean                 async);
  1194.  
  1195. EXTERN_API( OSErr )
  1196. PKillSendReq                    (ATPPBPtr                 thePBPtr,
  1197.                                  Boolean                 async);
  1198.  
  1199. EXTERN_API( OSErr )
  1200. PKillGetReq                        (ATPPBPtr                 thePBPtr,
  1201.                                  Boolean                 async);
  1202.  
  1203. EXTERN_API( OSErr )
  1204. ATPKillAllGetReq                (ATPPBPtr                 thePBPtr,
  1205.                                  Boolean                 async);
  1206.  
  1207. EXTERN_API( void )
  1208. BuildLAPwds                        (Ptr                     wdsPtr,
  1209.                                  Ptr                     dataPtr,
  1210.                                  short                     destHost,
  1211.                                  short                     prototype,
  1212.                                  short                     frameLen);
  1213.  
  1214. EXTERN_API( void )
  1215. BuildDDPwds                        (Ptr                     wdsPtr,
  1216.                                  Ptr                     headerPtr,
  1217.                                  Ptr                     dataPtr,
  1218.                                  AddrBlock                 netAddr,
  1219.                                  short                     ddpType,
  1220.                                  short                     dataLen);
  1221.  
  1222. EXTERN_API( void )
  1223. NBPSetEntity                    (Ptr                     buffer,
  1224.                                  ConstStr32Param         nbpObject,
  1225.                                  ConstStr32Param         nbpType,
  1226.                                  ConstStr32Param         nbpZone);
  1227.  
  1228. EXTERN_API( void )
  1229. NBPSetNTE                        (Ptr                     ntePtr,
  1230.                                  ConstStr32Param         nbpObject,
  1231.                                  ConstStr32Param         nbpType,
  1232.                                  ConstStr32Param         nbpZone,
  1233.                                  short                     socket);
  1234.  
  1235. EXTERN_API( short )
  1236. GetBridgeAddress                (void);
  1237.  
  1238. EXTERN_API( short )
  1239. BuildBDS                        (Ptr                     buffPtr,
  1240.                                  Ptr                     bdsPtr,
  1241.                                  short                     buffSize);
  1242.  
  1243. EXTERN_API( OSErr )
  1244. MPPOpen                            (void);
  1245.  
  1246. EXTERN_API( OSErr )
  1247. LAPAddATQ                        (ATQEntryPtr             theATQEntry);
  1248.  
  1249. EXTERN_API( OSErr )
  1250. LAPRmvATQ                        (ATQEntryPtr             theATQEntry);
  1251.  
  1252. EXTERN_API( OSErr )
  1253. ATPLoad                            (void);
  1254.  
  1255. EXTERN_API( OSErr )
  1256. ATPUnload                        (void);
  1257.  
  1258. EXTERN_API( OSErr )
  1259. NBPExtract                        (Ptr                     theBuffer,
  1260.                                  short                     numInBuf,
  1261.                                  short                     whichOne,
  1262.                                  EntityName *            abEntity,
  1263.                                  AddrBlock *            address);
  1264.  
  1265. EXTERN_API( OSErr )
  1266. GetNodeAddress                    (short *                myNode,
  1267.                                  short *                myNet);
  1268.  
  1269. EXTERN_API( Boolean )
  1270. IsMPPOpen                        (void);
  1271.  
  1272. EXTERN_API( Boolean )
  1273. IsATPOpen                        (void);
  1274.  
  1275. EXTERN_API( void )
  1276. ATEvent                            (long                     event,
  1277.                                  Ptr                     infoPtr);
  1278.  
  1279. EXTERN_API( OSErr )
  1280. ATPreFlightEvent                (long                     event,
  1281.                                  long                     cancel,
  1282.                                  Ptr                     infoPtr);
  1283.  
  1284. /*
  1285.     The following routines are obsolete and will not be supported on
  1286.     PowerPC. Equivalent functionality is provided by the routines
  1287.     above.
  1288. */
  1289. #if TARGET_CPU_68K
  1290. EXTERN_API( OSErr )
  1291. MPPClose                        (void);
  1292.  
  1293. EXTERN_API( OSErr )
  1294. LAPOpenProtocol                    (ABByte                 theLAPType,
  1295.                                  Ptr                     protoPtr);
  1296.  
  1297. EXTERN_API( OSErr )
  1298. LAPCloseProtocol                (ABByte                 theLAPType);
  1299.  
  1300. EXTERN_API( OSErr )
  1301. LAPWrite                        (ATLAPRecHandle         abRecord,
  1302.                                  Boolean                 async);
  1303.  
  1304. EXTERN_API( OSErr )
  1305. LAPRead                            (ATLAPRecHandle         abRecord,
  1306.                                  Boolean                 async);
  1307.  
  1308. EXTERN_API( OSErr )
  1309. LAPRdCancel                        (ATLAPRecHandle         abRecord);
  1310.  
  1311. EXTERN_API( OSErr )
  1312. DDPOpenSocket                    (short *                theSocket,
  1313.                                  Ptr                     sktListener);
  1314.  
  1315. EXTERN_API( OSErr )
  1316. DDPCloseSocket                    (short                     theSocket);
  1317.  
  1318. EXTERN_API( OSErr )
  1319. DDPRead                            (ATDDPRecHandle         abRecord,
  1320.                                  Boolean                 retCksumErrs,
  1321.                                  Boolean                 async);
  1322.  
  1323. EXTERN_API( OSErr )
  1324. DDPWrite                        (ATDDPRecHandle         abRecord,
  1325.                                  Boolean                 doChecksum,
  1326.                                  Boolean                 async);
  1327.  
  1328. EXTERN_API( OSErr )
  1329. DDPRdCancel                        (ATDDPRecHandle         abRecord);
  1330.  
  1331. EXTERN_API( OSErr )
  1332. ATPOpenSocket                    (AddrBlock                 addrRcvd,
  1333.                                  short *                atpSocket);
  1334.  
  1335. EXTERN_API( OSErr )
  1336. ATPCloseSocket                    (short                     atpSocket);
  1337.  
  1338. EXTERN_API( OSErr )
  1339. ATPSndRequest                    (ATATPRecHandle         abRecord,
  1340.                                  Boolean                 async);
  1341.  
  1342. EXTERN_API( OSErr )
  1343. ATPRequest                        (ATATPRecHandle         abRecord,
  1344.                                  Boolean                 async);
  1345.  
  1346. EXTERN_API( OSErr )
  1347. ATPReqCancel                    (ATATPRecHandle         abRecord,
  1348.                                  Boolean                 async);
  1349.  
  1350. EXTERN_API( OSErr )
  1351. ATPGetRequest                    (ATATPRecHandle         abRecord,
  1352.                                  Boolean                 async);
  1353.  
  1354. EXTERN_API( OSErr )
  1355. ATPSndRsp                        (ATATPRecHandle         abRecord,
  1356.                                  Boolean                 async);
  1357.  
  1358. EXTERN_API( OSErr )
  1359. ATPAddRsp                        (ATATPRecHandle         abRecord);
  1360.  
  1361. EXTERN_API( OSErr )
  1362. ATPResponse                        (ATATPRecHandle         abRecord,
  1363.                                  Boolean                 async);
  1364.  
  1365. EXTERN_API( OSErr )
  1366. ATPRspCancel                    (ATATPRecHandle         abRecord,
  1367.                                  Boolean                 async);
  1368.  
  1369. EXTERN_API( OSErr )
  1370. NBPRegister                        (ATNBPRecHandle         abRecord,
  1371.                                  Boolean                 async);
  1372.  
  1373. EXTERN_API( OSErr )
  1374. NBPLookup                        (ATNBPRecHandle         abRecord,
  1375.                                  Boolean                 async);
  1376.  
  1377. EXTERN_API( OSErr )
  1378. NBPConfirm                        (ATNBPRecHandle         abRecord,
  1379.                                  Boolean                 async);
  1380.  
  1381. EXTERN_API( OSErr )
  1382. NBPRemove                        (EntityPtr                 abEntity);
  1383.  
  1384. EXTERN_API( OSErr )
  1385. NBPLoad                            (void);
  1386.  
  1387. EXTERN_API( OSErr )
  1388. NBPUnload                        (void);
  1389.  
  1390. #endif  /* TARGET_CPU_68K */
  1391.  
  1392.  
  1393. #if PRAGMA_STRUCT_ALIGN
  1394.     #pragma options align=reset
  1395. #elif PRAGMA_STRUCT_PACKPUSH
  1396.     #pragma pack(pop)
  1397. #elif PRAGMA_STRUCT_PACK
  1398.     #pragma pack()
  1399. #endif
  1400.  
  1401. #ifdef PRAGMA_IMPORT_OFF
  1402. #pragma import off
  1403. #elif PRAGMA_IMPORT
  1404. #pragma import reset
  1405. #endif
  1406.  
  1407. #ifdef __cplusplus
  1408. }
  1409. #endif
  1410.  
  1411. #endif /* __APPLETALK__ */
  1412.  
  1413.